﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Events
{
    public partial class event_details : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Request.QueryString["id"]);
            int type = int.Parse(Request.QueryString["type"]);
            int question = int.Parse(Request.QueryString["question"]);
            int status = int.Parse(Request.QueryString["status"]);
            int check = int.Parse(Request.QueryString["check"]);
            var get_detail = new TblEventDetailController().FetchAll().Where(x => x.EventId == id);
            if(get_detail.ToList().Count!=0)
            {
                new TblEventDetailController().Update(get_detail.ToList()[0].Id, null, type, question,status,check);
            }
            else
            {
                new TblEventDetailController().Insert(id, type, question,status,check);
            }
        }
    }
}